import { useState } from 'react';
import './App.css';
import Dragger from './components/dragger';

function App() {
  const [offset, setOffset] = useState({
    left: 10,
    top: 20,
    width: 100,
    height: 100,
  });
  const onChange = value => {
    setOffset(value);
  };
  return (
    <div className="App">
      <button
        onClick={() =>
          setOffset({ left: 120, top: 120, width: 100, height: 100 })
        }
      >
        切换
      </button>
      <div className="dragger-demo">
        <Dragger {...{ value: offset, onChange }}>
          <div className="dragger-inner-demo"></div>
        </Dragger>
      </div>
    </div>
  );
}

export default App;
